package edu.nf.redismqes.common.base;

import edu.nf.redismqes.common.VO.ResultVO;
import org.springframework.http.HttpStatus;

/**
 * @ Author bin
 * @ Create  2025/10/21 上午11:09
 **/
public class BaseController {
    public <T> ResultVO<T> success(T data){
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(HttpStatus.OK.value());
        vo.setData(data);
        return vo;
    }

    /**
     * 仅响应成功
     * @return
     * @param <T>
     */
    public <T> ResultVO<T> success(){
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(HttpStatus.OK.value());
        return vo;
    }

    public <T> ResultVO<T> error(int code,String message){
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(code);
        vo.setMessage(message);
        return vo;
    }
}